import Vue from 'vue'
import App from './App'

import API from '@/constants/api'

Vue.config.productionTip = false
Vue.prototype.API = API


import store from './store/vuex.js';
Vue.prototype.$store = store;

import vueFilter from './plugins/filters.js'
vueFilter();


Vue.prototype.$nav = {
  push(url){
    uni.navigateTo({
      url
    })
  }
};

function toast(title){
  
  if(!title) return false;
  
  uni.hideLoading();
  uni.showToast({
    title,
    icon:'none'
  })
}
toast.__proto__.loading = () =>{
  uni.showLoading();
}

window.toast = toast;

import en from './locales/zh.js'
Vue.prototype.$t = (key)=>{
  const index = key.split(".");
  if(index[1]){
    return en[index[0]][index[1]]
  }
  return en[index[0]]
};

import SocketUser from '@/common/js/chat/SocketUser.js'


Vue.prototype.socketUser = new SocketUser.SocketUser()


App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()
